feat(core): Support attribute matching in ignoreSpans#20512
feat(core): Support attribute matching in ignoreSpans#20512nicohrubec merged 7 commits intodevelopfrom
ignoreSpans#20512Conversation
size-limit report 📦
|
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit aad1cb6. Configure here.
| import: createImport('init'), | ||
| gzip: true, | ||
| limit: '26 KB', | ||
| limit: '27 KB', |
There was a problem hiding this comment.
Bundle size increased across browser packages
Low Severity
Multiple browser bundle size limits were raised by ~1 KB gzipped (e.g., @sentry/browser 26→27 KB, tracing 44→45 KB, @sentry/svelte 26→27 KB, plus several CDN bundles). Per project rules, large bundle size increases in browser packages need to be flagged even when they may be unavoidable for a new feature.
Additional Locations (2)
Triggered by project rule: PR Review Guidelines for Cursor Bot
Reviewed by Cursor Bugbot for commit aad1cb6. Configure here.
| const attrsMatch = pattern.attributes | ||
| ? Object.entries(pattern.attributes).every(([key, valuePattern]) => | ||
| _matchesAttributeValue(span.attributes?.[key], valuePattern), | ||
| ) | ||
| : true; |
There was a problem hiding this comment.
Bug: The function shouldIgnoreSpan inconsistently handles an empty attributes: {} filter. It's ignored when alone but causes a match when combined with op or name due to vacuous truth.
Severity: LOW
Suggested Fix
To ensure consistent behavior, modify the logic to treat an empty attributes object as a non-match, regardless of whether op or name are also present. One approach is to adjust the attrsMatch check to explicitly return false if pattern.attributes is an empty object. This would align the behavior with the author's apparent intent, as demonstrated in the existing test cases.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: packages/core/src/utils/should-ignore-span.ts#L38-L42
Potential issue: There is an inconsistency in how `shouldIgnoreSpan` handles an empty
`attributes: {}` filter. When a filter pattern consists solely of `{ attributes: {} }`,
a guard condition correctly prevents it from matching any spans. However, if the pattern
is combined with an `op` or `name` (e.g., `{ op: 'http.server', attributes: {} }`), this
guard is bypassed. The logic then evaluates `Object.entries({}).every(...)` for the
attributes, which resolves to `true` due to vacuous truth. This causes the span to be
matched based on `op` or `name` alone, which is likely unintentional as a test
explicitly asserts that an empty attributes object should not cause a match.


Extends
ignoreSpanswith a new optional attributes field per theignoreSpansspec, letting users drop spans based on span attributes (in addition to name/description or op). String attribute values use pattern matching (substring / RegExp). Non-string values match by strict equality (arrays element-wise).Closes #20360